<template>
  <div class="app-container">
    <div v-show="type == 0 || type == 2" v-if="!convertBuiness">
      <el-row>
          <el-form
            :model="queryParams"
            ref="queryForm"
            size="mini"
            :inline="true"
            v-show="showSearch"
            class="search-form"
          >
            <!-- 第一行搜索条件 -->
            <div class="search-row">
            <el-form-item size="mini" label="企业名称" prop="enterpriseName">
              <el-input
                v-model="queryParams.enterpriseName"
                placeholder="请输入企业名称"
                clearable
                @keyup.enter.native="handleQuery"
                style="width: 200rem;"
              />
            </el-form-item>
              <el-form-item label="行政区域" prop="administrativeArea">
                <Treeselect
                  v-model="queryParams.administrativeArea"
                  :options="options"
                  :flat="true"
                  style="width: 200rem;margin-bottom: 10px;"
                  :show-count="true"
                  :normalizer="normalizer"
                  placeholder="请选择行政区域"
                  class="tree-select"
                />
              </el-form-item>
              <el-form-item size="mini" label="所属园区" prop="parkName">
                <el-select style="width: 200rem;"
                    v-model="queryParams.parkName"
                    placeholder="请选择所属园区"
                           >
                    <el-option

                      v-for="dict in dict.type.belong_to_park"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="所属行业" prop="industry">
                <industry-select
                  v-model="queryParams.industry"
                  @change="handleIndustryChange"
                />
              </el-form-item>

<!--              <div class="search-buttons">-->
                <el-form-item>
                  <el-button
                    type="primary"
                    icon="el-icon-search"
                    size="mini"
                    @click="handleQuery"
                  >搜索</el-button
                  >
                  <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
                  >重置</el-button
                  >
                </el-form-item>
            </div>
            <div class="search-row manager-row">
            <el-form-item
              size="mini"
              label="业务经理"
              prop="businessManager"
            >
              <div class="manager-tags">
      <span
        v-for="manager in managerList"
        :key="manager.userId"
        :class="['manager-tag', queryParams.businessManager === manager.userName ? 'active' : '']"
        @click="handleManagerSelect(manager)"
      >
        {{ manager.nickName }}
      </span>
              </div>
            </el-form-item>
            </div>
            <el-row :gutter="10" class="mb8">
              <el-col :span="1.5">
                <el-button
                  type="primary"
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleAdd"
                >新增</el-button>
              </el-col>
              <el-col :span="1.5">
                <el-button
                  v-if="isMarkas"
                  type="primary"
                  plain
                  icon="el-icon-set-up"
                  size="mini"
                  @click="handlePush"
                >共享</el-button
                >
              </el-col>
              <el-col :span="1.5">
                <el-button
                  type="info"
                  plain
                  icon="el-icon-upload2"
                  size="mini"
                  @click="handleImport"
                >导入</el-button
                >
              </el-col>
              <el-col :span="1.5">
                <el-button
                  type="warning"
                  v-if="isAdminPrivate==1"
                  plain
                  icon="el-icon-download"
                  size="mini"
                  @click="handleExport"
                >导出</el-button
                >
              </el-col>
              <!-- <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-edit" size="mini" @click="editMainClass">修改主分类</el-button>
              </el-col> -->
              <el-col :span="1.5">
                <el-button
                  type="primary"
                  plain
                  icon="el-icon-edit"
                  size="mini"
                  @click="userShow(1)"
                >修改业务经理</el-button
                >
              </el-col>
              <right-toolbar
                :showSearch.sync="showSearch"
                @queryTable="getList"
                :columns="columns"
              ></right-toolbar>
            </el-row>
          </el-form>
      </el-row>


        <div >
      <el-row style="margin-bottom: 4%">
        <el-table
            size="mini"
            height="500"
            :row-style="{ height: '30px' }"
            border
            :cell-style="{ padding: '0px' }"
            ref="table"
            v-loading="loading"
            @selection-change="handleSelectionChange"
            @row-click="clickRow"
            :header-cell-style="{'text-align':'center'}"
            :data="infoList"
            :class="{ 'no-multiple': markAs != null }"
            :row-class-name="tableRowClassName"
            highlight-current-row
          >
            <el-table-column
              type="selection"
              width="40"
              align="center"
              :selectable="setDisabled"
            />
            <el-table-column
              label="序"
              type="index"
              width="40"
              align="left"
              prop="index"
              :index="indexMethod"
              :show-overflow-tooltip="true"
            ></el-table-column>
            <el-table-column
              label="创建时间"
              align="center"
              prop="creationTime"
              width="95"
              sortable
              v-if="columns[16].visible"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              label="业务经理"
              align="center"
              prop="businessManager"
              :show-overflow-tooltip="true"
              width="70"
            />
            <el-table-column
              label="开发经理"
              align="center"
              prop="developmentManager"
              :show-overflow-tooltip="true"
              width="70"
            />
            <el-table-column
              label="企业名称"
              align="left"
              prop="enterpriseName"
              width="190"
              :show-overflow-tooltip="true"
              v-if="columns[0].visible"
            />
            <el-table-column
              label="所属区域"
              align="center"
              prop="areaName"
              v-if="columns[6].visible"
              width="100"
              sortable
              :show-overflow-tooltip="true"
            />
            <el-table-column
              label="行业类别"
              align="left"
              prop="industry"
              v-if="columns[11].visible"
              :show-overflow-tooltip="true"
              sortable
              width="100"
            >
              <template slot-scope="scope">
                <span>{{ getIndustryName(scope.row.industry) }}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="联系人"
              align="center"
              prop="contacts"
              width="70"
              v-if="columns[1].visible"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              label="联系人职务"
              align="center"
              prop="position"
              :show-overflow-tooltip="true"
              width="85"
            />
            <el-table-column
              label="联系电话"
              align="center"
              prop="telephone"
              :show-overflow-tooltip="true"
              width="110"
            />
            <el-table-column
              label="合同累计"
              align="center"
              prop="contractNum"
              :show-overflow-tooltip="true"
              v-if="columns[2].visible"
              sortable
              width="100"
            />
            <el-table-column
              label="成立日期"
              align="center"
              :show-overflow-tooltip="true"
              prop="establishmentDate"
              width="95"
              v-if="columns[12].visible"
              sortable
            >
              <template slot-scope="scope">
                <span>{{
                    parseTime(scope.row.establishmentDate, "{y}-{m}-{d}")
                  }}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="注册资金"
              align="center"
              :show-overflow-tooltip="true"
              prop="registeredCapital"
              v-if="columns[13].visible"
              width="95"
              sortable
            >  <template slot-scope="scope">
                <span>{{scope.row.registeredCapital}}万元</span>
            </template></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              label="最新客服时间"
              align="center"
              prop="satisfactionTime"
              width="110"
              v-if="columns[16].visible">
              <template slot-scope="scope">
                <span>{{
                    parseTime(scope.row.satisfactionTime, "{y}-{m}-{d}")
                  }}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="客户反馈"
              align="center"
              width="90"
              prop="satisfaction"/>
            <el-table-column
              :show-overflow-tooltip="true"
              label="注册状态"
              width="70"
              align="center"
              v-if="columns[16].visible"
              prop="registerStatus"
            >  <template slot-scope="scope">
              <el-tag :type="scope.row.registerStatus === 1 ? 'success' : 'danger'" size="mini">  {{ scope.row.registerStatus === 1 ? '已注册' : '未注册' }}</el-tag>
            </template></el-table-column>
            <el-table-column
              label="经营状态"
              width="100"
              align="center"
              prop="operateStatus"
              sortable
              v-if="columns[16].visible">
              <template slot-scope="scope">
                <dict-tag
                  :options="dict.type.operate_status"
                  :value="scope.row.operateStatus"
                />
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
              width="125"
              class-name="small-padding fixed-width"
              fixed="right"
            >
              <template slot-scope="scope">
                <!-- <el-tooltip content="修改" placement="top">
                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row, scope.$index + 1)"
                    ></el-button>
                </el-tooltip> -->
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate(scope.row, scope.$index + 1)"
                  title="编辑"
                ></el-button>

<!--                <el-button  size="mini" type="text" icon="el-icon-s-grid"-->
<!--                           @click="handleLvli(scope.row)" title="满意度调查"></el-button>-->
<!--                <el-button  size="mini" type="text" icon="el-icon-s-opportunity"-->
<!--                           @click="convertBusiness(scope.row)"></el-button>-->
                <el-button
                  v-if="scope.row.url != null"
                  @click.stop="handleView(scope.row.url)"
                  title="查看"
                  size="mini"
                  type="text"
                  icon="el-icon-document"
                ></el-button>
                <el-button
                  title="查看企业详情"
                  @click.stop="handleViewEnterprise(scope.row, scope.$index + 1)"
                  size="mini"
                  type="text"
                  icon="el-icon-view"
                ></el-button>
                <el-button
                 size="mini"
                 type="text"
                  icon="el-icon-delete"
                 title="删除"
                 @click="handleDelete(scope.row)">
                </el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            style="z-index: 999;height: 33px;position: fixed;width: 80%;bottom: 0;margin-top: 8%;margin-bottom: 0"
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
          />
      </el-row>
   `     </div>`
      <!-- 图片预览 -->
      <el-dialog :visible.sync="dialogVisible" append-to-body>
        <img width="100%" :src="dialogImageUrl" alt="" />
      </el-dialog>
<!--      满意度履历-->
      <el-dialog title="满意度调查记录表" :visible.sync="lvliOpen"  @close="lvliClose" width="1000px">
          <satisfied :enterprise-id="lvliId" v-if="lvliOpen"/>
      </el-dialog>
      <!-- pdf预览 -->
      <el-dialog :visible.sync="dialogVisiblePdf" append-to-body>
        <pdf
          v-for="item in pageTotal"
          :src="pdfUrl"
          :key="item"
          :page="item"
        ></pdf>
      </el-dialog>

      <el-dialog
        :title="upload.title"
        :visible.sync="upload.open"
        width="400px"
        append-to-body
      >
        <el-upload
          ref="upload"
          :limit="1"
          accept=".xlsx, .xls"
          :headers="upload.headers"
          :action="upload.url + '?updateSupport=' + upload.updateSupport"
          :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress"
          :on-success="handleFileSuccess"
          :auto-upload="false"
          drag
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <div class="el-upload__tip text-center" slot="tip">
            <span>仅允许导入xls、xlsx格式文件。</span>
            <el-link
              type="primary"
              :underline="false"
              style="font-size: 12px; vertical-align: baseline"
              @click="importTemplate"
              >下载模板</el-link
            >
          </div>
        </el-upload>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">确 定</el-button>
          <el-button @click="upload.open = false">关 闭</el-button>
        </div>
      </el-dialog>
      <select-user
        ref="select"
        :type="userType"
        :sign="sign"
        @ok="selectUser"
      ></select-user>
      <el-row>
        <div v-if="open">
          <el-row>
            <el-col :span="24">
              <Operate
                @change="close"
                ref="operateref"
                :classId="classId"
                :opt="opt"
                :id="id"
                :getId="getId"
                :obj="obj"
                :orgId = "orgId"
                :newMarkAs="newMarkAs"
              ></Operate>
            </el-col>
          </el-row>
        </div>
      </el-row>
    </div>
    <div v-if="type == 1">
      <Operate
        ref="operateref"
        @change="close"
        :classId="classId"
        :opt="edit"
        :id="id"
        :getId="getId"
        :index="index"
        :enterprise-name="enterpriseName"
        :orgId = "orgId"
        :newMarkAs="newMarkAs"
      ></Operate>
    </div>

    <!-- 推送操作 -->
    <el-dialog
      :title="titlePushClass"
      :visible.sync="openPushClass"
      width="1160px"
      append-to-body
    >
      <el-tabs v-model="activeNameShare" @tab-click="handleClickShare">
        <el-tab-pane label="客户列表" name="first">
          <el-form :model="form" ref="formDept" :rules="rules" size="mini">
            <el-row v-if="toAdmin">
              <el-col :span="8">
                <el-form-item
                  style="width: 183px"
                  label="接收企业"
                  size="mini"
                  prop="receiveEnterpriseName"
                  label-width="60px"
                >
                  <el-input
                    style="width: 340px"
                    v-model="form.receiveEnterpriseName"
                    placeholder="请选择接收企业"
                    :disabled="true"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="2">
                <el-button
                  style="margin-top: 0px; margin-left: 35px"
                  @click="clickDept"
                  type="primary"
                  size="mini"
                  >选 择</el-button
                >
              </el-col>
            </el-row>

            <el-row>
              <el-col v-if="isAdmin">
                <el-form
                  :model="queryParamsPrivate"
                  ref="queryFormPrivate"
                  size="mini"
                  :inline="true"
                  v-show="showSearch"
                >
                  <el-form-item
                    size="mini"
                    label="企业名称"
                    prop="enterpriseName"
                  >
                    <el-input
                      v-model="queryParamsPrivate.enterpriseName"
                      placeholder="请输入企业名称"
                      clearable
                      @keyup.enter.native="handleQuery"
                    />
                  </el-form-item>
                  <el-form-item
                    size="mini"
                    label="企业性质"
                    prop="enterpriseNature"
                  >
                    <el-select
                      v-model="queryParamsPrivate.enterpriseNature"
                      placeholder="请选择企业性质"
                      style="width: 150px"
                    >
                      <el-option
                        v-for="dict in dict.type.enterprise_nature"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="所属行业" prop="industry">
                    <el-select
                      v-model="queryParamsPrivate.industryType"
                      placeholder="请选择所属行业"
                      style="margin-right: 9rem"
                      @change="handleRadioChange"
                    >
                      <el-option
                        v-for="dict in dict.type.sys_org_type"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                    <el-select
                      v-show="queryParamsPrivate.industryType == null"
                      v-model="queryParamsPrivate.industry"
                      placeholder="请选择所属行业"
                    >
                    </el-select>
                    <el-select
                      v-show="queryParamsPrivate.industryType == 0"
                      v-model="queryParamsPrivate.industry"
                      placeholder="请选择企业所属行业"
                    >
                      <el-option
                        v-for="dict in dict.type.customer_industry"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                    <el-select
                      v-show="queryParamsPrivate.industryType == 1"
                      v-model="queryParamsPrivate.industry"
                      placeholder="请选择机构所属行业"
                    >
                      <el-option
                        v-for="dict in dict.type.customer_industry_serve"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                    <el-select
                      v-show="queryParamsPrivate.industryType == 2"
                      v-model="queryParamsPrivate.industry"
                      placeholder="请选择园区所属行业"
                    >
                      <el-option
                        v-for="dict in dict.type.customer_industry_garden"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="行政区域" prop="administrativeArea">
                    <Treeselect
                      v-model="queryParamsPrivate.administrativeArea"
                      :options="options"
                      :flat="true"
                      style="width: 250rem"
                      :show-count="true"
                      :normalizer="normalizer"
                      placeholder="请选择行政区域"
                    />
                  </el-form-item>
                  <el-form-item>
                    <el-button
                      type="primary"
                      icon="el-icon-search"
                      size="mini"
                      @click="handleQueryPrivate"
                      >搜索</el-button
                    >
                    <el-button
                      icon="el-icon-refresh"
                      size="mini"
                      @click="resetQueryPrivate"
                      >重置</el-button
                    >
                    <el-button type="primary" @click="submitPushForm"
                      >确 定</el-button
                    >
                  </el-form-item>
                </el-form>
                <el-table
                  width="1200px"
                  size="mini"
                  height="350"
                  :row-style="{ height: '30px' }"
                  border
                  :cell-style="{ padding: '0px' }"
                  ref="tableSelect"
                  v-loading="loading"
                  @selection-change="handlePushSelectionChange"
                  @row-click="clickRowTableSelect"
                  :data="infoPrivateList"
                  :class="{ 'no-multiple': markAs != null }"
                  :row-class-name="tableRowClassName"
                  highlight-current-row
                  row-key="enterpriseId"
                >
                  <el-table-column
                    type="selection"
                    width="40"
                    align="center"
                    :selectable="setDisabled"
                    :reserve-selection="true"
                  />
                  <el-table-column
                    label="序号"
                    type="index"
                    width="50"
                    align="center"
                    prop="index"
                    :index="indexMethod"
                    :show-overflow-tooltip="true"
                  ></el-table-column>
                  <el-table-column
                    label="创建时间"
                    align="center"
                    prop="creationTime"
                    width="90"
                    v-if="columns[16].visible"
                    :show-overflow-tooltip="true"
                  />
                  <el-table-column
                    label="企业名称"
                    align="center"
                    prop="enterpriseName"
                    width="220"
                    :show-overflow-tooltip="true"
                    v-if="columns[0].visible"
                  />
                  <el-table-column
                    label="企业来源"
                    align="center"
                    prop="enterpriseSource"
                    v-if="columns[7].visible"
                    width="100"
                    :show-overflow-tooltip="true"
                  >
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.enterprise_source"
                        :value="scope.row.enterpriseSource"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="是否入驻"
                    align="center"
                    width="70"
                    prop="enterpriseOrgId"
                    :show-overflow-tooltip="true"
                    :formatter="isOrg"
                  />
                  <el-table-column
                    label="是否共享过"
                    align="center"
                    width="85"
                    prop="enterpriseOrgId"
                    :show-overflow-tooltip="true"
                    :formatter="isShare"
                  />
                  <el-table-column
                    label="公司编号"
                    align="center"
                    width="93"
                    prop="enterpriseNo"
                    v-if="columns[5].visible"
                    :show-overflow-tooltip="true"
                    sortable
                    :formatter="isEnterpriseNo"
                  />
                  <el-table-column
                    label="联系人"
                    align="center"
                    prop="contacts"
                    width="70"
                    v-if="columns[1].visible"
                    :show-overflow-tooltip="true"
                  />
                  <el-table-column
                    label="联系电话"
                    align="center"
                    prop="telephone"
                    :show-overflow-tooltip="true"
                    v-if="columns[2].visible"
                    width="100"
                  />
                  <el-table-column
                    label="行政区域"
                    align="center"
                    prop="areaName"
                    v-if="columns[6].visible"
                    width="70"
                    :show-overflow-tooltip="true"
                  />
                  <el-table-column
                    label="企业性质"
                    align="center"
                    prop="enterpriseNature"
                    v-if="columns[7].visible"
                    width="100"
                    :show-overflow-tooltip="true"
                  >
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.enterprise_nature"
                        :value="scope.row.enterpriseNature"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="所属行业"
                    align="center"
                    prop="industry"
                    v-if="columns[11].visible"
                    :show-overflow-tooltip="true"
                    width="220"
                  >
                    <template slot-scope="scope">
                      <span>{{ getIndustryName(scope.row.industry) }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="注册资金"
                    align="center"
                    :show-overflow-tooltip="true"
                    prop="registeredCapital"
                    v-if="columns[13].visible"
                    width="100"
                    sortable
                  />
                  <el-table-column
                    label="状态"
                    width="50"
                    align="center"
                    prop="status"
                    v-if="columns[16].visible"
                  >
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.enterprise_status"
                        :value="scope.row.status"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="创建人"
                    align="center"
                    :show-overflow-tooltip="true"
                    prop="creationName"
                    v-if="columns[9].visible"
                    width="100"
                  />
                </el-table>
                <pagination
                  v-show="totalPrivate > 0"
                  :total="totalPrivate"
                  :page.sync="queryParamsPrivate.pageNum"
                  :limit.sync="queryParamsPrivate.pageSize"
                  @pagination="getListPrivate"
                />
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="共享日志" name="four">
          <el-table
            size="mini"
            height="400"
            :row-style="{ height: '30px' }"
            border
            :cell-style="{ padding: '0px' }"
            v-loading="loading"
            :data="listLog"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column
              label="序号"
              type="index"
              width="50"
              align="center"
              prop="index"
              :index="indexLog"
              :show-overflow-tooltip="true"
            ></el-table-column>
            <el-table-column
              label="接收企业"
              align="center"
              prop="receiveEnterpriseName"
            >
              <template slot-scope="scope">
                <!-- 使用按钮作为可点击元素，并绑定点击事件 -->
                <el-button
                  size="small"
                  @click="
                    handleClickEnterpriseName(scope.row, scope.$index + 1)
                  "
                  type="text"
                >
                  {{ scope.row.receiveEnterpriseName }}
                </el-button>
              </template>
            </el-table-column>
            <el-table-column label="推送人" align="center" prop="pushName" />
            <el-table-column label="推送时间" align="center" prop="pushTime">
              <template slot-scope="scope">
                <span>{{
                  parseTime(scope.row.pushTime, "{y}-{m}-{d} {h}:{i}:{s}")
                }}</span>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="totalLog > 0"
            :total="totalLog"
            :page.sync="queryParamsLog.pageNum"
            :limit.sync="queryParamsLog.pageSize"
            @pagination="getListLog"
          />
          <!-- <div style="text-align: center;">
                    <el-button @click="cancel">关 闭</el-button>
                </div> -->
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer" style="margin-top: -35px">
        <el-button @click="cancelShareClass">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 接收企业名称跳转到详情表数据操作 -->
    <el-dialog
      :title="titleLogDeailClass"
      :visible.sync="openLogDeailClass"
      width="1100px"
      height="300px"
      append-to-body
    >
      <el-table
        size="mini"
        height="400"
        :row-style="{ height: '30px' }"
        border
        :cell-style="{ padding: '0px' }"
        v-loading="loading"
        :data="listLogDetail"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column
          label="序号"
          type="index"
          width="50"
          align="center"
          prop="index"
          :index="indexLogDetail"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="推送企业名称"
          align="center"
          prop="shareEnterpriseName"
        />
        <el-table-column label="推送人" align="center" prop="pushName" />
        <el-table-column
          label="推送时间"
          align="center"
          prop="pushTime"
          width="180"
        >
          <template slot-scope="scope">
            <span>{{
              parseTime(scope.row.pushTime, "{y}-{m}-{d} {h}:{i}:{s}")
            }}</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="totalLogDetail > 0"
        :total="totalLogDetail"
        :page.sync="queryParamsLogDetail.pageNum"
        :limit.sync="queryParamsLogDetail.pageSize"
        @pagination="handleClickEnterpriseName"
      />
      <div slot="footer" class="dialog-footer" style="margin-top: -35px">
        <el-button @click="cancelShareDetailClass">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 平台向客户推送资源时弹窗组织机构页面 -->
    <el-dialog
      :title="titleDeptClass"
      :visible.sync="openDeptClass"
      width="1150px"
      height="300px"
      append-to-body
    >
      <el-form
        :model="queryParamsDept"
        ref="queryFormDept"
        size="small"
        :inline="true"
        v-show="this.$store.state.user.info.deptId == 100"
      >
        <el-form-item
          label="企业名称"
          prop="deptName"
          v-show="this.$store.state.user.info.deptId == 100"
        >
          <el-input
            v-model="queryParamsDept.deptName"
            placeholder="请输入企业名称"
            clearable
            @keyup.enter.native="handleQueryDept"
          />
        </el-form-item>
        <el-form-item
          label="状态"
          prop="status"
          v-show="this.$store.state.user.info.deptId == 100"
        >
          <el-select
            v-model="queryParamsDept.status"
            placeholder="部门状态"
            clearable
          >
            <el-option
              v-for="dict in dict.type.sys_normal_disable"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item v-show="this.$store.state.user.info.deptId == 100">
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQueryDept"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQueryDept"
            >重置</el-button
          >
          <el-button type="primary" size="mini" @click="submitDeptForm"
            >确定</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        v-loading="loading"
        :data="deptList"
        @row-click="clickRowDept"
        ref="tableDept"
        @selection-change="handleSelectionChangeDept"
        :row-style="{ height: '30px' }"
        border
        :cell-style="{ padding: '0px' }"
        height="400px"
      >
        <el-table-column type="selection" width="40" align="center" />
        <el-table-column
          label="序号"
          type="index"
          align="center"
          prop="index"
          :index="indexMethodDept"
        ></el-table-column>
        <el-table-column
          prop="deptName"
          label="企业名称"
          width="240"
          align="center"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="address"
          label="企业地址"
          width="300"
          align="center"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          prop="companyOrigin"
          label="企业来源"
          :show-overflow-tooltip="true"
          align="center"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.enterprise_source"
              :value="scope.row.companyOrigin"
            />
          </template>
        </el-table-column>
        <!-- <el-table-column prop="abbreviate" label="企业简称" show-overflow-tooltip="true"></el-table-column> -->
        <el-table-column
          prop="nature"
          label="企业性质"
          :show-overflow-tooltip="true"
          align="center"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.enterprise_nature"
              :value="scope.row.nature"
            />
          </template>
        </el-table-column>
        <el-table-column
          prop="contacts"
          label="联系人"
          align="center"
          width="70"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          prop="phone"
          label="联系电话"
          width="100"
          :show-overflow-tooltip="true"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="legalPerson"
          label="法人代表"
          width="70"
          align="center"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column prop="companyType" label="机构类别" align="center">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_org_type"
              :value="scope.row.companyType"
            />
          </template>
        </el-table-column>
        <el-table-column
          prop="foundTime"
          label="成立时间"
          :show-overflow-tooltip="true"
          width="90"
          align="center"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.foundTime, "{y}-{m}-{d}") }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="status" label="状态" width="80" align="center">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_normal_disable"
              :value="scope.row.status"
            />
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="totalDept > 0"
        :total="totalDept"
        :page.sync="queryParamsDept.pageNum"
        :limit.sync="queryParamsDept.pageSize"
        @pagination="getListDept"
      />
    </el-dialog>
    <!-- <Operate ></Operate>   -->
    <div v-if="convertBuiness">
      <bussinsess @change="closeEle" :opt="edit" :uuid="uuid" :isClick="isClick" :enterprise-id="form.enterpriseId" :enterprise-name="form.enterpriseName"></bussinsess>
    </div>
  </div>
</template>

<script>
import {
  listDept,
  listDeptByEnterpriseInfo,
  getDept,
  delDept,
  addDept,
  updateDept,
  listDeptExcludeChild,
} from "@/api/system/dept";
import {
  listDetail,
  getDetail,
  delDetail,
  addDetail,
  updateDetail,
} from "@/api/enterprise/sharelogdetail";
import {
  listToAdmin,
  listInfo,
  listInfoPrivate,
  getInfo,
  delInfo,
  getBusinessManagerList,
  updateInfo,
  editMainClass,
  editBusinessManager,
} from "@/api/enterprise/info";
import { listLog, addLog, getLog } from "@/api/enterprise/sharelog";
//import MainType from "@/components/MainType/index"
import { getToken } from "../../../utils/auth";
import SelectUser from "../../system/role/selectUser.vue";
//import { listType } from "@/api/maintype/type";
import bussinsess from "../../enterprise/businessinfo/operate.vue";
import Operate from "./operate.vue";
import Treeselect from "@riophae/vue-treeselect";
import pdf from "vue-pdf";
import satisfied from "./satisfied.vue";
import { listArea } from "@/api/area/area";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Template from "../../membertemplate/index.vue";
import { getIndustryTree } from "@/api/enterprise/industry";
import IndustrySelect from './components/IndustrySelect';

export default {
  name: "Info",
  props: {
    markAs: {
      type: String,
      default: null,
    },
    enterprise: {
      type: String,
      default: null,
    },
    //选择企业的时候不能展示树节点的,同样，人员管理选择企业的时候，其他标签页不展示操作按钮
    isTree: {
      type: Boolean,
      default: true,
    },
    //判断是否是通过活动培训管理/问卷调查管理 传过来的，是的话允许多选
    train: {
      type: Boolean,
      default: false,
    },
    //判断是否是通过人员管理或者其他客户管理下面调用的，只是单纯的选择客户或者企业
    isEnterprise: {
      type: Boolean,
      default: false,
    },
  },
  components: {Template, Operate, SelectUser, Treeselect, pdf,satisfied,bussinsess, IndustrySelect },
  dicts: [
    "belong_to_park",
    "customer_industry_serve",
    "customer_industry_garden",
    "sys_org_type",
    "sys_normal_disable",
    "enterprise_nature",
    "enterprise_source",
    "customer_industry",
    "enterprise_status",
    "operate_status",
    "register_status",
    "template_class",
    "customer_industry_new"
  ],
  data() {
    return {
      orgId: null,
      rowId: null,
      isMarkas: false,
      isAdminPrivate: null,//是否是管理员（包含企业管理员）
      totalDept: 0,
      isAdmin: true,
      toAdmin: false,
      totalLog: 0,
      totalLogDetail: 0,
      listLog: [],
      listLogDetail: [],
      lvliId: null,
      // 查询参数
      queryParamsLog: {
        pageNum: 1,
        pageSize: 15,
        shareEnterpriseName: null,
        pushId: null,
      },
      openPushClass: false,
      openLogDeailClass: false,
      //pdf预览
      dialogImageUrl: "",
      dialogImageUrlPdf: "",
      managerList:[],//业务经理列表
      pageTotal: null,
      dialogVisible: false,
      dialogVisiblePdf: false,
      refreshKey: 0,
      //typeCode: 'enterprise',
      formClass: {},
      openMainClass: false,
      titleClass: "修改主分类",
      titlePushClass: "资源共享",
      titleLogDeailClass: "共享日志详情",
      titleDeptClass: "选择接收企业",
      openDeptClass: false,
      optionData: null,
      userType: "1",
      sign: "1",
      // 遮罩层
      loading: true,
      loadingPrivate: true,
      // 选中数组
      ids: [],
      shareIds: [],
      shareNames: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      totalPrivate: 0,
      // 企业信息表格数据
      infoList: [],
      infoPrivateList: [],
      classId: null,
      enterpriseName:null,
      //导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        newMarkAs: null,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url:
          process.env.VUE_APP_BASE_API +
          "/enterprise/info/importData?markAs=" +
          this.$route.query.markAs +
          "",
      },
      // 列信息
      columns: [
        { key: 0, label: `企业名称`, visible: true },
        { key: 1, label: `联系人`, visible: true },
        { key: 2, label: `联系电话`, visible: true },
        { key: 4, label: `公司编号`, visible: true },
        { key: 5, label: `状态`, visible: true },
        { key: 6, label: `行政区域`, visible: true },
        { key: 7, label: `企业性质`, visible: true },
        { key: 8, label: `开户银行`, visible: true },
        { key: 9, label: `开户账号`, visible: true },
        { key: 10, label: `税号`, visible: true },
        { key: 11, label: `所属行业`, visible: true },
        { key: 12, label: `成立日期`, visible: true },
        { key: 13, label: `注册资金`, visible: true },
        { key: 14, label: `附件`, visible: true },
        { key: 15, label: `最新操作时间`, visible: true },
        { key: 16, label: `经营状态`, visible: true },
        { key: 17, label: `创建时间`, visible: true },
        { key: 18, label: `状态`, visible: true },
      ],

      // 弹出层标题
      title: "",
      lvliOpen:false,
      // 是否显示弹出层
      open: false,
      selectionList: [],
      titleName: "",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 15,
        enterpriseName: null,
        enterpriseNature: null,
        administrativeArea: null,
        industry: null,
        businessManager: null,
        transactionId: null,
        markAs: null,
        parkName:null
      },
      queryParamsPrivate: {
        pageNum: 1,
        pageSize: 15,
        enterpriseName: null,
        enterpriseSource: null,
        enterpriseAbbreviation: null,
        administrativeArea: null,
        legalRepresentative: null,
        establishmentDate: null,
        contractAmount: null,
        enterpriseLabel: null,
        registeredCapital: null,
        industry: null,
        industryType: null,
        contacts: null,
        telephone: null,
        bankName: null,
        taxId: null,
        developmentId: null,
        transactionId: null,
        developmentManager: null,
        businessManager: null,
        enterpriseAddress: null,
        businessScope: null,
        enterpriseNature: null,
        markAs: null,
        belongTo: null,

        classificationId: null,
      },
      convertBuiness: false,
      // 表单参数
      form: {},
      uuid: "",
      isClick: true,
      // 表单校验
      rules: {
        enterpriseName: [
          { required: true, message: "企业名称不能为空", trigger: "blur" },
        ],
      },
      type: 0,
      options:null,
      opt: "add",
      id: "",
      C: "",
      obj: null,
      index: null,
      edit: "edit",
      userNewId: null,
      activeName: "first",
      activeNameShare: "first",
      selectionPushList: [],
      queryParamsLogDetail: {
        pageNum: 1,
        pageSize: 15,
        logId: null,
        shareEnterpriseName: null,
        pushName: null,
        pushTime: null,
      },
      isMainTree: false,
      deptList: [],
      // 查询参数
      queryParamsDept: {
        pageNum: 1,
        pageSize: 15,
        deptName: undefined,
        companyType: undefined,
        status: undefined,
      },
      receiveEnterpriseId: null,
      receiveEnterpriseName: null,
      // Add loadedTabs tracking
      loadedTabs: {
        first: false,
        second: false,
        third: false,
        four: false
      },
      industryOptions: [], // 行业选项
      industryMap: new Map(), // 缓存行业数据
    };
  },
  created() {
    this.activeNameShare = "first";
    this.userId = this.$store.state.user.name;
    this.isAdminPrivate=this.$store.state.user.info.isAdmin;
    this.newMarkAs = this.$route.query.markAs;
    if (this.$route.query.markAs == "1" && this.$store.state.user.info.companyType != "0" || this.$store.state.user.info.userId == "2") {
      this.isMarkas = true;
    }
    if (
      this.$route.query.enterpriseName != "" &&
      this.$route.query.enterpriseName != null &&
      this.$route.query.enterpriseName != undefined
    ) {
      this.queryParams.enterpriseName = this.$route.query.enterpriseName;
    }
    this.newWebsiteAs = this.$route.query.websiteAs;
    if (this.newWebsiteAs == "1") {
      this.isShowBtn = false;
    } else {
      this.isShowBtn = true;
    }
    if (Reflect.has(this.$route.query, "markAs")) {
      this.queryParams.markAs = this.$route.query.markAs;
      this.queryParamsPrivate.markAs = this.$route.query.markAs;
      //this.markAs = this.$route.query.markAs
    }
    if (this.markAs != null) {
      this.queryParams.markAs = this.markAs;
      this.queryParamsPrivate.markAs = this.$route.query.markAs;
    }
    this.loadFirstTabData();
    this.area();
    this.getBusinessManagerList();
    //this.getListPrivate();
    //this.listType();
    this.getIndustryTreeData();
  },
  methods: {
    area() {
      listArea({}).then(response => {
        this.options = response.data;
      });
    },
    //查询业务经理列表
    getBusinessManagerList() {
      getBusinessManagerList().then(response => {
        this.managerList = response;
      });
    },
    closeEle() {
      this.form.enterpriseName=null;
      this.form.enterpriseId=null;
      this.convertBuiness = false;
    },
    handleRadioChange() {
      this.queryParams.industry = '';
    },
    //转商机
    convertBusiness(row) {
      this.uuid = this.guid();
      this.edit = "add";
      this.form.enterpriseName=row.enterpriseName;
      this.form.enterpriseId=row.enterpriseId;
      this.isClick = true;
      this.convertBuiness = true;
    },
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.areaId,
        label: node.areaName,
        isDisabled: false,
        children: node.list && node.list.length > 0 ? node.list : 0,
      };
    },
    isEnterpriseNo(row, column) {
      //alert(row.enterpriseNo)
      var status = [];
      if (row.enterpriseNo > 100) {
        status.push("KH0" + row.enterpriseNo);
      } else if (row.enterpriseNo >= 1 && row.enterpriseNo < 10) {
        status.push("KH000" + row.enterpriseNo);
      } else if (row.enterpriseNo >= 10 && row.enterpriseNo < 100) {
        status.push("KH00" + row.enterpriseNo);
      }

      return status.join("");
    },
    isOrg(row, column) {
      var status = [];
      if (row.enterpriseOrgId == "0") {
        status.push("否");
      } else {
        status.push("是");
      }
      return status.join("");
    },
    isShare(row, column) {
      var status = [];
      if (row.isShare == "0") {
        status.push("否");
      } else {
        status.push("是");
      }
      return status.join("");
    },

    // 推送代码 开始  ---------------//
    clickDept(row, index) {
      this.resetQueryDept();
      this.openDeptClass = true;
      this.getListDept();
    },
    // 处理业务经理选择
    handleManagerSelect(manager) {
      if (this.queryParams.businessManager === manager.userName) {
        this.queryParams.businessManager = null; // 再次点击取消选择
      } else {
        this.queryParams.businessManager = manager.userName;
      }
      this.handleQuery(); // 触发搜索
    },
    /** 查询企业为服务机构列表 */
    getListDept() {
      this.queryParamsDept.companyType = "1";
      listDeptByEnterpriseInfo(this.queryParamsDept).then(response => {
        this.deptList = response.rows;
        this.totalDept = response.total;
        this.loading = false;
      });
    },
    //满意度履历
    handleLvli(row){
      this.lvliId=row.enterpriseId;
      this.lvliOpen=true;
    },
    lvliClose(){
      this.lvliOpen=false;
      this.lvliId=null;
      this.getList();
    },
    guid() {
      function S4() {
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
      }
      return (
        S4() +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        S4() +
        S4()
      );
    },

    //接收企业名称跳转到详情信息
    handleClickEnterpriseName(row, index) {
      if (row.id != undefined) {
        this.rowId = row.id;
      }

      this.openLogDeailClass = true;
      //日志详情表查询
      this.loading = true;
      this.queryParamsLogDetail.logId = this.rowId;
      listDetail(this.queryParamsLogDetail).then(response => {
        this.listLogDetail = response.rows;
        this.totalLogDetail = response.total;
        this.loading = false;
      });
    },
    /** 推送按钮操作 弹窗 */
    handlePush(row, index) {
      this.resetQueryPrivate();
      this.activeNameShare = "first";
      this.openPushClass = true;
      //判断当前操作人员是平台管理员还是企业
      if (this.userNewId == 2) {
        //平台管理员
        this.toAdmin = true;
        this.isAdmin = false;
        this.form.receiveEnterpriseName = "";
      } else {
        this.getListPrivate();
        this.isAdmin = true;
        this.toAdmin = false;
      }
      this.$refs.tableSelect.clearSelection(); // 清空所有选择
    },
    //共享关闭弹窗
    cancelShareClass() {
      this.activeNameShare = "first";
      this.form.receiveEnterpriseName = "";
      this.openPushClass = false;
    },
    //共享日志详情关闭弹窗
    cancelShareDetailClass() {
      this.queryParamsLogDetail.pageNum = 1;
      this.openLogDeailClass = false;
    },

    //接收企业数据反显
    handleSelectionChangeDept(selection) {
      if (selection.length > 1) {
        this.$refs.tableDept.clearSelection(); // 清空所有选择
        this.$refs.tableDept.toggleRowSelection(selection.pop()); // 设置选择项
      } else {
        this.receiveEnterpriseId = selection.map(item => item.deptId); //單選
        this.receiveEnterpriseName = selection.map(item => item.deptName);
      }
    },
    //平台选择接收的企业操作
    submitDeptForm() {
      //alert("平台确定接收的企业操作")
      if (
        this.receiveEnterpriseName == "" ||
        this.receiveEnterpriseName == null
      ) {
        this.$modal.msgError("请选择接收共享资源的企业！");
      } else {
        this.form.receiveEnterpriseName = "";
        this.form.receiveEnterpriseId = this.receiveEnterpriseId.toString();
        this.$set(
          this.form,
          "receiveEnterpriseName",
          this.receiveEnterpriseName.toString()
        );
        this.openDeptClass = false;
        this.listToAdmin();
      }
    },
    //平台客户数据查询
    listToAdmin() {
      this.loading = true;
      this.queryParamsPrivate.belongTo = this.$store.state.user.info.orgId;
      listToAdmin(this.queryParamsPrivate).then(response => {
        this.infoPrivateList = response.rows;
        this.totalPrivate = response.total;
        this.loading = false;
        this.isAdmin = true;
      });
    },
    /** 只查询归属于自己的企业信息列表 */
    getListPrivate() {
      this.loading = true;
      if (this.$store.state.user.info.orgId == 100) {
        this.listToAdmin();
      } else {
        listInfoPrivate(this.queryParamsPrivate).then(response => {
          this.infoPrivateList = response.rows;
          this.totalPrivate = response.total;
          this.loading = false;
        });
      }
    },
    // 多选框选中数据
    handlePushSelectionChange(selection) {
      if (this.markAs != null) {
        this.selectionPushList = [];
        if (selection.length > 1) {
          this.$refs.table.clearSelection();
          this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
        }
        this.selectionPushList = [selection[selection.length - 1]];
      } else {
        this.selectionPushList = selection;
      }
      this.shareIds = selection.map(item => item.enterpriseId);
      this.shareNames = selection.map(item => item.enterpriseName);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },

    //企业确定共享操作
    submitPushForm() {
      if (this.selectionPushList.length == 0) {
        this.$modal.msgError("请选择要共享的客户");
      } else {
        if (this.userNewId == 2) {
          this.$modal
            .confirm(
              "是否确认将已选择的客户资源共享给：" +
                this.receiveEnterpriseName +
                "？"
            )
            .then(function () {})
            .then(() => {
              const params = {
                receiveEnterpriseId: this.receiveEnterpriseId.toString(),
                receiveEnterpriseName: this.receiveEnterpriseName.toString(),
                shareEnterpriseId: this.shareIds.toString(),
                shareEnterpriseName: this.shareNames.toString(),
              };
              addLog(params).then(response => {
                this.getList();
                this.listToAdmin();
                this.$modal.msgSuccess("共享成功");
                this.$refs.table.clearSelection();
              });
            })
            .catch(() => {});
        } else {
          this.$modal
            .confirm("是否确认将已选择的客户资源共享给：见实力工业企业云平台？")
            .then(function () {})
            .then(() => {
              const params = {
                receiveEnterpriseId: "100",
                receiveEnterpriseName: "见实力工业企业云平台",
                shareEnterpriseId: this.shareIds.toString(),
                shareEnterpriseName: this.shareNames.toString(),
              };
              addLog(params).then(response => {
                this.getList();
                this.getListPrivate();
                this.$modal.msgSuccess("共享成功");
                this.$refs.table.clearSelection();
              });
            })
            .catch(() => {});
        }

        //this.$emit("ok", this.selectionPushList)
      }
    },

    /** 查询客户资源共享日志列表 */
    getListLog() {
      this.loading = true;
      listLog(this.queryParamsLog).then(response => {
        this.listLog = response.rows;
        this.totalLog = response.total;
        this.loading = false;
      });
    },
    //行点击
    clickRow(row) {
      this.$refs.table.toggleRowSelection(row);
    },
    clickRowTableSelect(row){
      this.$refs.tableSelect.toggleRowSelection(row);
    },
    //行点击
    clickRowDept(row) {
      this.$refs.tableDept.toggleRowSelection(row);
    },
    handleClickShare(tab, event) {
      if (tab.name == "four") {
        this.getListLog();
      }
    },
    //结束

    //pdf预览
    handlePictureCardPreviewPdf(url) {
      this.pdfUrl = pdf.createLoadingTask(url);
      // 获取页码
      this.pdfUrl.promise
        .then(pdf => (this.pageTotal = pdf.numPages))
        .catch(error => {});
      this.dialogImageUrlPdf = url;
      this.dialogVisiblePdf = true;
    },
    //文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
          response.msg +
          "</div>",
        "导入结果",
        { dangerouslyUseHTMLString: true }
      );
      this.getList();
    },

    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
      this.getList();
      this.upload.open = false;
    },
    handleImport() {
      this.upload.title = this.titleName + "导入";
      this.upload.open = true;
    },
    // listType() {
    //   listType({ typeCode: 'enterprise' }).then(res => {
    //     this.optionData = res.data;
    //   })
    // },
    //行点击事件
    handleCurrentChange(row, column, event) {
      //this.refreshKey++;
      //如果是从人员管理过来的，不展示详情数据
      // if (this.isTree === true) {
      //   this.opt = 'details'
      //   this.obj = row
      //   this.id = row.enterpriseId;
      //   this.open = true
      //   this.$nextTick(() => {
      //     this.$refs.operateref.selectActiveName()
      //   })
      // }
    },
    //当活动培训管理发送方访问的时候，如果用户自身的企业中有没有入驻的，不能让它进行选择
    setDisabled(row, index) {
      if (this.isTree === false && this.isEnterprise === false) {
        return row.settle;
      } else {
        return true;
      }
    },
    indexMethod(index) {
      return (
        (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
      );
    },
    indexMethodDept(index) {
      return (
        (this.queryParamsDept.pageNum - 1) * this.queryParamsDept.pageSize +
        index +
        1
      );
    },
    indexLog(index) {
      return (
        (this.queryParamsLog.pageNum - 1) * this.queryParamsLog.pageSize +
        index +
        1
      );
    },
    indexLogDetail(index) {
      return (
        (this.queryParamsLogDetail.pageNum - 1) *
          this.queryParamsLogDetail.pageSize +
        index +
        1
      );
    },
    /** 查询企业信息列表 */
    getList() {
      this.loading = true;
      this.userNewId = this.$store.state.user.info.userId;
      this.queryParams.transactionId = this.$store.state.user.info.userId;
      console.log("搜索",this.queryParams)
      listInfo(this.queryParams).then(response => {
        //alert(response.rows.)
        this.infoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    cancelClass() {
      this.openMainClass = false;
      this.resetClass();
    },
    // 表单重置
    resetClass() {
      this.formClass = {
        classificationId: null,
      };
    },
    // 取消按钮
    cancel() {
      this.$emit("change");
    },
    submitForm() {
      if (this.selectionList.length == 0) {
        this.$modal.msgError("请选择客户！");
      }
      if (this.train === false) {
        this.$emit("ok", this.selectionList[0]);
      } else {
        this.$emit("ok", this.selectionList);
      }
      this.$refs.table.clearSelection();
    },

    //索引初始化到对象
    tableRowClassName({ row, rowIndex }) {
      //把每一行的索引放进row
      row.index =
        (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
        rowIndex +
        1;
    },
    // 表单重置
    reset() {
      this.form = {
        enterpriseId: null,
        enterpriseName: null,
        enterpriseSource: null,
        enterpriseAbbreviation: null,
        administrativeArea: null,
        legalRepresentative: null,
        establishmentDate: null,
        contractAmount: null,
        enterpriseLabel: null,
        registeredCapital: null,
        industry: null,
        contacts: null,
        telephone: null,
        bankName: null,
        taxId: null,
        developmentId: null,
        transactionId: null,
        developmentManager: null,
        businessManager: null,
        enterpriseAddress: null,
        businessScope: null,
        enterpriseNature: null,
        markAs: null,
        belongTo: null,
        creationTime: null,
        operateTime: null,
        operateId: null,
        departmentId: null,
        departmentName: null,
        organizationId: null,
        organizationName: null,
        delFlag: null,
        classificationId: null,
      };
      this.resetForm("form");
    },
    // editMainClass() {
    //     const params = {
    //       businessId: this.ids.toString(),
    //       mainClassId: this.formClass.classificationId,
    //     };
    //     editMainClass(params).then(response => {
    //       //this.$modal.msgSuccess("修改成功");
    //       //this.openMainClass = false;
    //       //this.getList();
    //     });
    //   // if (this.ids.length == 0) {
    //   //   this.$message.error("请选择要修改的信息！");
    //   // } else {
    //   //   this.openMainClass = true;
    //   // }
    // },
    userShow(type) {
      this.show = type;
      if (type == "1") {
        if (this.ids.length == 0) {
          this.$message.error("请选择要修改的信息！");
        } else {
          this.$refs.select.show();
        }
      } else {
        this.$refs.select.show();
      }
    },

    selectUser(userId, userName, phone, position,nickName) {
      if (this.show == "1") {
        const params = {
          businessId: this.ids.toString(),
          transactionId: userId,
          businessManager: nickName,
        };
        editBusinessManager(params).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.getList();
        });
      } else if (this.show == "2") {
        this.$set(this.form, "approvalName", nickName);
        this.$set(this.form, "approvalId", userId);
      }
    },
    /** 推送搜索按钮操作 */
    handleQueryPrivate() {
      this.queryParamsPrivate.pageNum = 1;
      this.getListPrivate();
    },

    resetQueryPrivate() {
      //this.resetForm("queryFormPrivate");
      this.queryParamsPrivate.enterpriseName = null;
      this.queryParamsPrivate.enterpriseNature = null;
      this.queryParamsPrivate.industry = null;
      this.queryParamsPrivate.industryType = null;
      this.queryParamsPrivate.administrativeArea = null;
      this.handleQueryPrivate();
    },
    resetQueryDept() {
      //this.resetForm("queryFormPrivate");
      this.queryParamsDept.deptName = null;
      this.queryParamsDept.companyType = null;
      this.queryParamsDept.status = null;
      this.handleQueryDept();
    },

    /** 平台推送 机构搜索按钮操作 */
    handleQueryDept() {
      this.queryParamsDept.pageNum = 1;
      this.getListDept();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.enterpriseName = null;
      this.queryParams.enterpriseNature = null;
      this.queryParams.industry = null;
      this.queryParams.industryType = null;
      this.queryParams.administrativeArea = null;
      this.queryParams.transactionId = null;
      this.queryParams.parkName = null;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      if (this.markAs != null && this.train !== true) {
        this.selectionList = [];
        if (selection.length > 1) {
          this.$refs.table.clearSelection();
          this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
        }
        this.selectionList = [selection[selection.length - 1]];
      } else {
        this.selectionList = selection;
      }
      this.ids = selection.map(item => item.enterpriseId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.getId = this.guid();
      this.edit = "add";
      this.type = 1;
    },
    /** 修改按钮操作 */
    handleUpdate(row, index) {
      this.reset();
      this.enterpriseName = row.enterpriseName;
      //this.index = (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index
      this.edit = "edit";
      this.id = row.enterpriseId;
      console.log("企业信息",row)
      this.orgId = row.enterpriseOrgId
      this.type = 1;
      // const enterpriseId = row.enterpriseId || this.ids
      // getInfo(enterpriseId).then(response => {
      //   this.form = response.data;
      //   this.open = true;
      //   this.title = "修改企业信息";
      // });
    },
    /** 查看按钮操作 */
    handleViewEnterprise(row,index){
      this.reset();
      this.enterpriseName = row.enterpriseName;
      this.edit = "details";
      this.id = row.enterpriseId;
      this.orgId = row.enterpriseOrgId
      this.type = 1;
    },

    //树点击事件
    getNode(data, node, obj) {
      this.reset();
      //主分类

      //this.queryParams.cabinetId = data.id
      this.classId = data.id;
      this.queryParams.classificationId = data.id;
      this.getList();
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const enterpriseIds = row.enterpriseId || this.ids;
      this.$modal
        .confirm('是否确认删除企业名称为"' + row.enterpriseName + '"的数据项？')
        .then(function () {
          return delInfo(enterpriseIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "enterprise/info/export",
        {
          ...this.queryParams,
        },
        this.titleName + "_" + new Date().getTime() + ".xlsx"
      );
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download(
        "/enterprise/info/importTemplate",
        {},
        `客户管理数据.xlsx`
      );
    },
    close: function (data) {
      if (data == undefined) {
        this.type = 0;
        this.open = data;
      }
      this.getList();
    },
    //文件预览
    handleView(url) {
      if (url != null && url != "" && url.indexOf(".pdf") !== -1) {
        this.handlePictureCardPreviewPdf(url);
      } else {
        this.handlePictureCardPreview(url);
      }
    },
    handlePictureCardPreview(url) {
      this.dialogImageUrl = url;
      this.dialogVisible = true;
    },
    // Add new methods for loading tab data
    loadFirstTabData() {
      this.getList();
      this.loadedTabs.first = true;
    },

    loadSecondTabData() {
      this.getListPrivate();
      this.loadedTabs.second = true;
    },

    loadThirdTabData() {
      this.getListShared();
      this.loadedTabs.third = true;
    },

    loadFourthTabData() {
      this.getListLog();
      this.loadedTabs.four = true;
    },

    // Add tab click handler for lazy loading
    handleTabClick(tab) {
      const tabName = tab.name;
      if (!this.loadedTabs[tabName]) {
        switch(tabName) {
          case 'first':
            this.getList();
            this.loadedTabs.first = true;
            break;
          case 'second':
            this.getListPrivate();
            this.loadedTabs.second = true;
            break;
          case 'third':
            this.getListShared();
            this.loadedTabs.third = true;
            break;
          case 'four':
            this.getListLog();
            this.loadedTabs.four = true;
            break;
        }
      }
    },
    // 获取行业树形数据
    getIndustryTreeData() {
      getIndustryTree().then(response => {
        this.industryOptions = this.handleIndustryData(response.data);
      });
    },

    // 处理行业数据,构建缓存
    handleIndustryData(data) {
      data.forEach(item => {
        this.industryMap.set(item.industryId, item.name);
        if (item.children && item.children.length > 0) {
          this.handleIndustryData(item.children);
        }
      });
      return data;
    },

    // 获取行业名称
    getIndustryName(industryId) {
      if (!industryId) return '';
      return this.industryMap.get(industryId) || '';
    },
    handleIndustryChange(val) {
      this.handleQuery();
    },
  },
};
</script>
<style scoped>
/*******所属区域下拉样式**********

/* 所属区域渲染的数据字体样式 */
::v-deep .vue-treeselect__option{
  color: #686161;
}
/* 输入框字体样式 */
::v-deep .vue-treeselect__input{
  color: #686161;
}
::v-deep .vue-treeselect__placeholder, .vue-treeselect__single-value {
  top: -2px;

}
::v-deep .vue-treeselect__single-value {
  top: -2px;
  color: #686161;
}
::v-deep .vue-treeselect__control {
  height:0px;
  padding-left: 9px;
  padding-right: 0px;
}
/**************************************/



.no-multiple {
  // 隐藏多选
  ::v-deep
    .el-table_2_column_20
    .is-center
    .el-table-column--selection
    .is-leaf
    .el-table__cell {
    display: none;
  }
}
.manager-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  .manager-tag {
    padding: 4px 12px;
    border: 1px solid #DCDFE6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;

    &:hover {
      border-color: #409EFF;
      color: #409EFF;
    }

    &.active {
      background-color: #409EFF;
      border-color: #409EFF;
      color: #fff;
    }
  }
}


</style>
<style>
 #app{
  overflow: hidden !important;
}
</style>
